<%@page import="weaver.hrm.HrmUserVarify" %>
<%@page import="weaver.hrm.User" %>
<%@page import="java.util.regex.Matcher" %>
<%@page import="java.util.regex.Pattern" %>
<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%
    User user = HrmUserVarify.getUser(request, response);
    String addr = request.getRemoteAddr();
    String loginid = user.getLoginid();
    String url = "";
    if (isInner(addr)) {
         url = "http://10.10.10.2:8080/interface/sso_wf.jsp?loginid=" + loginid;
        //String url = "http://10.10.10.2:8080/interface/sso_wf.jsp?loginid=" + loginid;
        //response.sendRedirect(url);
    } else {
        url = "http://58.214.5.19:8088/interface/sso_wf.jsp?loginid=" + loginid;
        //String url = "http://58.214.5.19:8088/interface/sso_wf.jsp?loginid=" + loginid;
        //response.sendRedirect(url);
    }
%>
<%!
    public static boolean isInner(String ip) {
        String reg = "(10|172|192)\\.([0-1][0-9]{0,2}|[2][0-5]{0,2}|[3-9][0-9]{0,1})\\.([0-1][0-9]{0,2}|[2][0-5]{0,2}|[3-9][0-9]{0,1})\\.([0-1][0-9]{0,2}|[2][0-5]{0,2}|[3-9][0-9]{0,1})";//正则表达式=。 =、懒得做文字处理了、
        Pattern p = Pattern.compile(reg);
        Matcher matcher = p.matcher(ip);
        return matcher.find();
    }
%>
<script type="text/javascript">
    window.location.href = '<%=url%>';
</script>